package com.ruoyi.xsc.api.factory;


import com.ruoyi.xsc.api.RemoteCheerService;
import com.ruoyi.xsc.api.RemoteGasTypeService;
import com.ruoyi.xsc.api.domain.Cheer;
import com.ruoyi.xsc.api.domain.GasType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * 汽油类型服务降级处理
 * 
 * @author ruoyi
 */
@Component
public class RemoteGasTypeFallbackFactory implements FallbackFactory<RemoteGasTypeService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteGasTypeFallbackFactory.class);

    @Override
    public RemoteGasTypeService create(Throwable throwable)
    {
        log.error("汽油服务调用失败:{}", throwable.getMessage());
        return new RemoteGasTypeService()
        {

            @Override
            public List<GasType> getList(String source) {
                return new ArrayList<>();
            }
        };
    }
}
